*****************************************************
*** DESCRIPTIVES ALL DVs  ***************************
*****************************************************

***ALLIANCES
use "Alliance_RepData.dta", clear

gen missing=0
replace missing=1 if solschangeNA_3==. | dembothNA==. |violate==.
keep if missing==0

tab violate
tab dembothNA
tab solschangeNA_3
tab dembothNA solschangeNA_3, row
tab solschangeNA_3 if dembothNA==1
tab solschangeNA_3 if dembothNA==0
tab solschangeNA_3 dembothNA if violate==1
tab dembothNA if solschangeNA_3==1 & violate==1

tab dembothNA othldrtransNA_3, row

tab irregNA_3
tab irregNA_3 solschangeNA_3, row
tab irregNA dembothNA 
tab irregNA dembothNA if violate==1

replace missing=1 if regtransNA==. | abscincperch1_10==. | decthreat1_10==. | allyCW1==. | postCW==. | mixedalliance==. | nomicoop==. | estmode==. | milinst==. | abscincperch2_10==. | incthreat2_10==. | solschangeNB==. 
keep if missing==0


tab regtransNA
sum regtransNA
tab regtransNA solschangeNA_3
tab regtransNA solschangeNA_3 if violate==1

tab abscincperch1_10 
sum abscincperch1_10 
tab decthreat1_10 
sum decthreat1_10 
tab allyCW1 
sum allyCW1
tab postCW 
sum postCW
tab mixedalliance 
sum mixedalliance
tab nomicoop 
sum nomicoop
tab estmode 
sum estmode
tab milinst 
sum milinst
tab abscincperch2_10 
sum abscincperch2_10
tab incthreat2_10
sum  incthreat2_10
tab regtransNB 
tab solschangeNB_3 
sum solschangeNB_3

tab solschangeNA_3 dembothNA if (milinst==1 | milinst==2)  & violate==1
tab solschangeNA_3 dembothNA if milinst==0 & violate==1

ttest violate if dembothNA==1 & milinst==0, by(solschangeNA_3)
ttest violate if dembothNA==1 & milinst!=0, by(solschangeNA_3)
ttest violate if dembothNA==0 & milinst==0, by(solschangeNA_3)
ttest violate if dembothNA==0 & milinst!=0, by(solschangeNA_3)


***UNGA
use "UNGA_RepData.dta", clear

gen missing=0
replace missing=1 if logvotech==. | solsch==. | demboth==.
keep if missing==0

sum logvotech

tab solsch
tab demboth
tab demboth solsch, row
tab solsch if demboth==1
tab solsch if demboth==0

tab demboth othldrtrans, row

tab irreg
tab irreg solsch, row
tab irreg demboth

replace missing=1 if regtrans==. | allyCW==. | abscincperch10==. | gdpdrop5==. | logrealGDPpcG==.
keep if missing==0

tab regtrans
sum regtrans 
tab allyCW 
sum allyCW 
tab CWend
sum CWend
tab abscincperch10 
sum abscincperch10
tab gdpdrop5 
sum gdpdrop5
sum logrealGDPpcG


***SANCTIONS
use "Sanctions_RepData.dta", clear

gen missing=0
replace missing=1 if sdemmboth==. | ssolsch4==. |sendercap2==.
keep if missing==0

*all cases
tab sendercap2

tab ssolsch4
tab sdemmboth
tab sdemmboth ssolsch4, row 
tab ssolsch4 if sdemmboth==1
tab ssolsch4 if sdemmboth==0
tab ssolsch4 sdemmboth if sendercap2==1

tab sdemmboth snonsolsch4, row

tab sirreg4
tab sirreg4 ssolsch4, row
tab sirreg4 sdemmboth
tab sirreg4 sdemmboth if sendercap2==1

tab US

tab legis if US==1
tab legis if US==0 & sdemm==1

replace missing=1 if abscincperch10A==. | gdpdrop5A==. | sregtrans==. | allyCWA==. | postCW==. | abscincperch10B==. | tregtrans==. | tsolsch4==. | gdpratio2008==. | costs==. | high==. | ifthen==.
keep if missing==0

tab sregtrans
sum sregtrans
tab abscincperch10A
sum abscincperch10A
tab gdpdrop5A
sum gdpdrop5A
tab allyCWA
sum allyCWA
tab postCW
sum postCW

tab abscincperch10B
sum abscincperch10B
tab tregtrans 
sum tregtrans
tab tsolsch4
sum tsolsch4
sum gdpratio2008
tab costs
sum costs
tab high 
sum high
tab ifthen
sum ifthen

**all sanctions w/out US
tab sendercap2 if US!=1

tab ssolsch4 if US!=1
tab sdemmboth if US!=1
tab ssolsch4 sdemmboth if US!=1
tab ssolsch4 sdemmboth if sendercap2==1 & US!=1

tab abscincperch10A if US!=1
tab gdpdrop5A if US!=1
tab sregtrans if US!=1
tab postCW if US!=1
tab allyCWA if US!=1

tab abscincperch10B if US!=1
tab tregtrans if US!=1 
tab tsolsch4 if US!=1
sum gdpratio2008 if US!=1
tab costs if US!=1
tab high if US!=1
tab ifthen if US!=1


****TRADE
use "Trade_RepData.dta", clear
tsset ddyad year

gen solschdumA_3_lag= solschdumA_3[_n-1]
gen dembothA_lag= dembothA[_n-1]
gen irregA_3_lag=irregA_3[_n-1]
gen othldrtransdumA_3_lag=othldrtransdumA_3[_n-1]
gen regtransA_lag= regtransA[_n-1]
gen allyCW1_lag= allyCW1[_n-1]
gen CWend_lag= CWend[_n-1]
gen gdpdrop51_lag= gdpdrop51[_n-1]
gen conflicta_lag= conflicta[_n-1]
gen armconflict_lag= armconflict[_n-1]
gen gattwto_lag= gattwto[_n-1]
gen pta_lag=pta[_n-1]
gen solschdumB_3_lag= solschdumB_3[_n-1]
gen regtransB_lag= regtransB[_n-1]
gen allyCW2_lag=allyCW2[_n-1]
gen conflictb_lag=conflictb[_n-1]
gen gdpln_a_lag= gdpln_a[_n-1]
gen gdpln_b_lag=gdpln_b[_n-1]

gen missing=0
replace missing=1 if solschdumA_3_lag==. | dembothA_lag==. | MRdv_rest==.
keep if missing==0

sum MRdv_rest 

tab solschdumA_3_lag
tab dembothA_lag
tab solschdumA_3_lag if dembothA_lag==1
tab solschdumA_3_lag if dembothA_lag==0
tab dembothA_lag solschdumA_3_lag, row

tab othldrtransdumA_3
tab dembothA_lag othldrtransdumA_3_lag, row

tab irregA_3_lag 
tab irregA_3_lag solschdumA_3_lag, row 

replace missing=1 if regtransA_lag==. | allyCW1_lag==. | conflicta_lag==. | armconflict_lag==. |  gattwto_lag==. | pta_lag==. | solschdumB_3_lag==. | regtransB_lag==. | allyCW2_lag==. | conflictb_lag==. | gdpln_a_lag==. | gdpln_b_lag==.
keep if missing==0

tab regtransA_lag
sum regtransA_lag
tab allyCW1_lag
sum allyCW1_lag
tab CWend_lag
sum CWend_lag
tab gdpdrop51_lag
sum gdpdrop51_lag
tab conflicta_lag
sum conflicta_lag
tab armconflict_lag
sum armconflict_lag
tab gattwto_lag
sum gattwto_lag
tab pta_lag
sum pta_lag
tab solschdumB_3_lag
sum solschdumB_3_lag
tab regtransB_lag
sum regtransB_lag
tab allyCW2_lag
sum allyCW2_lag
tab conflictb_lag
sum conflictb_lag
sum gdpln_a_lag
sum gdpln_b_lag
